﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using MemberServerBLL;

public partial class ControlPanel_Role_Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btn_Add_Click(object sender, EventArgs e)
    {
        ObjectDataSourceRoles.InsertParameters["roleName"].DefaultValue = txt_Roles.Text;
        ObjectDataSourceRoles.Insert();
    }


    protected void gv_Roles_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            RoleData drv = (RoleData)e.Row.DataItem;
            LinkButton btn_Delete = (LinkButton)e.Row.FindControl("lnkBtn_Delete");
            if (drv.NumberOfUsersInRole != 0)
            {
                btn_Delete.Visible = false;
            }
            else
            {
                btn_Delete.Attributes.Add("Onclick", "return confirm(\"您是否确认删除[" + drv.RoleName + "]角色吗？\")");
            }
        }
    }
}
